<template>
  <div class="article-com">
    <div v-show="showDelete" class="list-item-delete">
      <span class="pull_left">{{ item.text }}</span>
      <span class="pull_right" @click.stop="deleteCurItem(item, index)"
        >删除</span
      >
    </div>
    <!-- 样式1 -->
    <div v-if="item.stylesType == 0">
      <!-- 样式1 未添加商品时 -->
      <div v-if="!item.shopId.length" class="styleOne">
        <div class="header_title">
          {{ item.text }}
          <img src="http://oss.ztwlxx.cn/icon_right.png" alt="" />
        </div>
        <div class="item">
          <div class="imgbox">
            <img src="https://oss.ztwlxx.cn/default999.png" alt="" />
          </div>
          <div class="textbox  ">
            <div class="left">
              <p>文章标题</p>
              <p>部分文章内容......</p>
            </div>
            <div class="right">
              <span>2018-7-30</span>
            </div>
          </div>
        </div>
      </div>
      <!-- 样式1 添加文章时时 -->
      <div v-else class="styleOne">
        <div class="header_title">
          {{ item.text }}
          <img src="http://oss.ztwlxx.cn/icon_right.png" alt="" />
        </div>
        <div v-for="(items, indexs) in item.shopId" :key="indexs" class="item">
          <div class="imgbox">
            <img
              :src="$store.state.qiniu + items.linkSrc + $store.state.imgRotate"
              alt=""
            />
          </div>
          <div class="textbox">
            <div class="left">
              <p>{{ items.jump_name }}</p>
              <p>{{ items.brief }}</p>
            </div>
            <div class="right">
              <span>{{ items.create_at }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 样式2 -->
    <!-- <div v-else></div> -->
  </div>
</template>

<script>
export default {
  props: {
    item: {
      type: Object,
      default: () => {}
    },
    index: {
      type: Number,
      default: -1
    },
    showDelete: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    deleteCurItem(e, i) {
      this.$emit("deleteCurItem", e, i);
    }
  }
};
</script>

<style lang="scss" scoped>
.article-com {
  position: relative;
  .styleOne {
    .header_title {
      height: 46px;
      line-height: 46px;
      padding: 0 10px;
      color: #595961;
      font-size: 16px;
      background-color: #fff;
      img {
        float: right;
        height: 14px;
        margin: 16px 0;
      }
    }
    .item {
      // margin-top: 10px;
      background-color: #fff;
      margin-top: 0;
      .imgbox {
        width: 100%;
        padding: 10px;
        position: relative;
        img {
          width: 100%;
          height: 154px;
          display: block;
        }
        p {
          position: absolute;
          bottom: 10px;
          padding: 5px;
          background-color: #494949;
          color: #fff;
          width: 354px;
          opacity: 0.8;
          span {
            text-decoration: line-through;
          }
        }
      }
      .textbox {
        padding: 0 10px 10px 10px;
        .left {
          float: left;
          width: 250px;
          padding-right: 10px;
          p:first-child {
            color: #333333;
            font-size: 14px;
            padding-bottom: 2px;
          }
          p:last-child {
            font-size: 12px;
            color: #595961;
          }
        }
        .right {
          float: right;
          font-size: 12px;
          padding-top: 20px;
          // span {
          //   border-radius: 6px;
          //   background-color: #e1143a;
          //   color: #fff;
          //   padding: 5px;
          // }
        }
      }
    }
  }
}
</style>
